package rdd

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object RDD_DemoExample02 {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
    conf.setMaster("local")
    conf.setAppName("RDD_DemoExample02")

    val sc: SparkContext = new SparkContext(conf)
    val filesRDD: RDD[(String, String)] = sc.wholeTextFiles("data/littleFiles/*")
    filesRDD
      .map(t => t._2)
      .coalesce(1)
      .saveAsTextFile("output")


    sc.stop()
  }
}
